﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Xml;
using SaturniLibrary.Web.Log.DataProvider;
using System.Web.Hosting;

namespace SaturniLibrary.Web.Log
{
    public class WebLogConfig
    {
        #region Property

        public IWebLogDataProvider DataProvider { get; set; }
        public string LogFolder { get; set; }
        public bool LogEnable { get; set; }
        #endregion

        private WebLogConfig()
        {

        }

        private static WebLogConfig instance;
        public static WebLogConfig Instance
        {
            get
            {
                return instance;
            }
        }

        private static WebLogConfig _default;
        private static WebLogConfig Default
        {
            get
            {
                if (_default == null)
                {
                    _default = new WebLogConfig();
                    _default.DataProvider = new SQLServerDataProvider();
                    _default.LogFolder = HostingEnvironment.MapPath("~/logs");
                    _default.LogEnable = false;
                }
                return _default;
            }
        }

        public static void Config()
        {
            instance = Default;
        }

        public static void Config(WebLogConfig config)
        {
            instance = config;
        }       
    }
}